package com.ruoyi.flow.flow.entity;

import com.ruoyi.flow.common.utils.SpringContextHolder;
import com.ruoyi.flow.flow.workflow.FlowService;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.engine.impl.persistence.entity.DeploymentEntity;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;

/**
 * @Author: wtian
 * @Description:
 * @Date: Created in 11:01 2018/8/17
 * @Version: 1.0
 */
public class FlowDefinition {
    private String id;
    private String key;
    private String name;
    private String description;
    private String deployId;
    private String deployUser;
    private String deployTimeStr;
    private BpmnModel bpmnModel;

    public FlowDefinition(ProcessDefinitionEntity definition) {
        FlowService flowService = SpringContextHolder.getBean("flowService");

        this.id = definition.getId();
        this.key = definition.getKey();
        this.name = definition.getName();
        this.description = definition.getDescription();
        this.bpmnModel = FlowService.activityService().getBpmnModelByDefinitionId(this.id);
        this.deployId = definition.getDeploymentId();
        DeploymentEntity deploy = FlowService.deploymentService().getDeploymentByDefinitionKey(this.key);
    }
}
